package com.situ.scientific.service.impl;

import com.situ.scientific.dao.IProjectDao;
import com.situ.scientific.dao.impl.ProjectDaoImpl;
import com.situ.scientific.pojo.Project;
import com.situ.scientific.pojo.query.ProjectQuery;
import com.situ.scientific.pojo.vo.ProjectIdVo;
import com.situ.scientific.pojo.vo.ProjectVo;
import com.situ.scientific.service.IProjectService;
import com.situ.scientific.util.PageRusult;

import java.util.List;

public class ProjectserviceImpl implements IProjectService {
    IProjectDao projectDao = new ProjectDaoImpl();
    @Override
    public void deleteAll(String[] ids) {

    }

    @Override
    public void updateStatus(String id, int i) {
        projectDao.updateStatus(id,i);
    }

    @Override
    public void update(Project project) {
        projectDao.update(project);
    }

    @Override
    public void add(Project project) {
        projectDao.add(project);
    }

    @Override
    public int deleteById(int i) {
        return 0;
    }

    @Override
    public PageRusult selectByPage(ProjectQuery projectQuery) {
       //1.totalCount
        int totalCount = projectDao.totalCount(projectQuery);
        //2.list
        List<ProjectVo> list =  projectDao.selectByPage(projectQuery);
        PageRusult<ProjectVo> pageRusult = new PageRusult<>(0,"",totalCount,list);
        return pageRusult;
    }

    @Override
    public void updateApprove(String id, int status) {
        projectDao.updateApprove(id,status);
    }

    @Override
    public ProjectIdVo selectById(String id) {
        return projectDao.selectById(id);
    }
}
